import request from '@/utils/request';

//获取角色分页列表
export const getRoleList = (page, limit, roleName) => {
  return request.get(`/admin/acl/role/${page}/${limit}`, {
    params: {roleName}
  });
};
//保存新角色
export const saveRole = (role) => {
  return request.post('/admin/acl/role/save', role);
};
//给角色授权
export const setRole = (roleId, permissionId) => {
  return request.post('/admin/acl/permission/doAssign', null, {
    params: {roleId,permissionId},
  });
};
//获取一个角色的所有权限数据
export const getAllRole = (roleId) => {
  return request.get(`/admin/acl/permission/toAssign/${roleId}`);
};
//更新一个角色
export const updateRole = (role) => {
  return request.put('/admin/acl/role/update', role);
};
//删除某个角色
export const removeRole = (id) => {
  return request.delete(`/admin/acl/role/remove/${id}`);
};
//批量删除多个角色
export const removeRoles = (data) => {
  return request({
    url:'/admin/acl/role/batchRemove',
    method: 'post',
    data
  });
};